#!/bin/bash
echo ""
echo "*** KeePassX Installation ***"
echo "***     Version 0.2.2     ***"
echo "***      www.x2on.de      ***"
echo ""
echo "KeePassX herunterladen..."
sudo wget http://mesh.dl.sourceforge.net/sourceforge/keepassx/KeePassX-0.2.2.deb
echo "Paketquellen hinzufügen..."
sudo cp /etc/apt/sources.list ~/sources.list.bak
sudo echo 'deb http://xnv4.xandros.com/xs2.0/upkg-srv2 etch main contrib non-free' >> /tmp/sources.list.tmp
sudo cp /tmp/sources.list.tmp /etc/apt/sources.list
echo "LibPng3 installieren..."
sudo apt-get update -qq
sudo apt-get install -y -f -qq libpng3 --force-yes
echo "KeePassX installieren..."
sudo dpkg -i /home/user/KeePassX-0.2.2.deb
echo "Icons für Easy-Mode herunterladen..."
sudo wget -nv http://www.x2on.de/eeepc/keepass_norm.png -O /opt/xandros/share/AsusLauncher/keepass_norm.png
sudo wget -nv http://www.x2on.de/eeepc/accessibility_keepass_hi.png -O /opt/xandros/share/AsusLauncher/accessibility_keepass_hi.png
sudo wget -nv http://www.x2on.de/eeepc/business_keepass_hi.png -O /opt/xandros/share/AsusLauncher/business_keepass_hi.png
sudo wget -nv http://www.x2on.de/eeepc/home_keepass_hi.png -O /opt/xandros/share/AsusLauncher/home_keepass_hi.png
sudo wget -nv http://www.x2on.de/eeepc/student_keepass_hi.png -O /opt/xandros/share/AsusLauncher/student_keepass_hi.png
echo "Backup der Simpleui-XML..."
cp /opt/xandros/share/AsusLauncher/simpleui.rc ~/simpleui.rc.keepass
echo "Icons installieren..."
cat /opt/xandros/share/AsusLauncher/simpleui.rc | grep -v /simpleui >/tmp/simpleui.rc.tmp
cat >>/tmp/simpleui.rc.tmp  <<EOF

<parcel simplecat="Work" extraargs="/usr/local/bin/keepass" icon="keepass_norm.png" 
selected_icon="keepass_hi.png">
      <name lang="en">KeePassX</name>
      <name lang="de_DE">KeePassX</name>
      <desc lang="en">KeePassX passwordmanager</desc>
</parcel>

</simpleui>

EOF
sudo cp /tmp/simpleui.rc.tmp /opt/xandros/share/AsusLauncher/simpleui.rc
echo "Paketquellen wiederherstellen..."
sudo cp ~/sources.list.bak /etc/apt/sources.list
echo "Aufräumen..."
sudo rm KeePassX-0.2.2.deb
sudo rm /tmp/sources.list.tmp
sudo rm ~/sources.list.bak